package com.wuyou.sso.common.annotation;


import com.wuyou.sso.common.component.CustomizedResourceServerAutoConfiguration;
import com.wuyou.sso.common.component.CustomizedSecurityBeanDefinitionRegistrar;
import org.springframework.context.annotation.Import;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;

import java.lang.annotation.*;

/**
 * @author lishangbu
 * @date 2018/11/10
 * <p>资源服务注解
 */
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@EnableResourceServer
@EnableGlobalMethodSecurity(prePostEnabled = true)
@Import({
        CustomizedResourceServerAutoConfiguration.class,
        CustomizedSecurityBeanDefinitionRegistrar.class
})
public @interface EnableCustomizedResourceServer {

    /**
     * 是否开启本地模式
     * 本地模式直连redis数据源进行token校验
     * 非本地模式走remote调用去认证中心校验token
     *
     * @return true
     */
    boolean isLocal() default true;
}
